package com.black.cat.jvm.instructions.control.rtn;


import com.black.cat.jvm.instructions.base.InstructionNoOperands;
import com.black.cat.jvm.rtda.Frame;
import com.black.cat.jvm.rtda.JObject;
import com.black.cat.jvm.rtda.JThread;

//从当前方法返回对象应用
public class ARETURN extends InstructionNoOperands {

    @Override
    public void execute(Frame frame) {
        JThread thread = frame.thread();
        Frame currentFrame = thread.popFrame();
        Frame invokerFrame = thread.topFrame();
        JObject ref = currentFrame.operandStack().popRef();
        invokerFrame.operandStack().pushRef(ref);
    }

}